//
//  PPHomeAlbumSearchTableViewCell.m
//  pickpic
//
//  Created by Jinxiao on 9/11/16.
//  Copyright © 2016 MicroDream. All rights reserved.
//

#import "PPHomeAlbumSearchTableViewCell.h"

@implementation PPHomeAlbumSearchTableViewCell

- (void)setAlbum:(PPAlbumModel *)album {
    _album = album;

    NSArray <PPAlbumImageModel *> *images = [PPAlbumImageModel where:@{@"auuid": album.auuid, @"deleted": @(NO)}];

    _titleLabel.text = album.title;

    if(album.coverURLString.length > 0) {
        [album.coverURLString applyToImageView:_coverView];
    } else {
        if(images.count == 0) {
            _coverView.image = [UIImage imageNamed:@"album-nothing"];
            [_coverView setNeedsLayout];
        } else {
            _coverView.artwork = images.firstObject.artwork;
        }
    }
}

@end
